An association list is a list representing a mapping from one set of values to another; any list whose elements are cons cells is an association list.
This function searches the association list a-list for an element whose
carmatches (in the sense of:test,:test-not, and:key, or by comparison witheql) a given item. It returns the matching element, if any, otherwisenil. It ignores elements of a-list which are not cons cells. (This corresponds to the behavior ofassqandassocin Emacs Lisp; Common Lisp'sassocignoresnils but considers any other non-cons elements of a-list to be an error.)
This function searches for an element whose
cdrmatches item. If a-list represents a mapping, this applies the inverse of the mapping to item.
The assoc-if,
assoc-if-not, rassoc-if, and
rassoc-if-not functions are defined similarly.
Two simple functions for constructing association lists are: